From 1b002f925814000d8d2dcad5a3f32501e5388f36 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 14 Sep 2018 15:30:59 +0100 Subject: [PATCH] d/tests/build: Update for GTK+ 4.0 --- debian/changelog | 1 + debian/tests/build | 43 ++++++++++++++++++++++++++++++------------- 2 files changed, 31 insertions(+), 13 deletions(-) mode change 100644 => 100755 debian/tests/build diff --git a/debian/changelog b/debian/changelog index 2d818c375a..bdda2a0c7b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -55,6 +55,7 @@ gtk+4.0 (3.94.0-1) UNRELEASED; urgency=medium * libgtk-4-0.postrm.in: Remove the correct cache files * d/rules: Defang dh_auto_test when built with nocheck * Stop using Priority: extra + * d/tests/build: Update for GTK+ 4.0 -- Jeremy Bicha Fri, 19 Jan 2018 22:05:35 -0500 diff --git a/debian/tests/build b/debian/tests/build old mode 100644 new mode 100755 index 1a46e30881..5f8caeead7 --- a/debian/tests/build +++ b/debian/tests/build @@ -1,6 +1,9 @@ #!/bin/sh # autopkgtest check: Build and run a program against GTK, to verify that the # headers and pkg-config file are installed correctly +# Based on examples/hello-world.c: +# (C) 1997-2015 GTK+ contributors (see debian/copyright) +# and on an older autopkgtest: # (C) 2012 Canonical Ltd. # Author: Martin Pitt @@ -16,27 +19,41 @@ cat < gtktest.c static gboolean do_quit (gpointer user_data) { - gtk_main_quit (); + gtk_widget_destroy (user_data); + g_object_unref (user_data); + return G_SOURCE_REMOVE; +} + +static void +activate (GtkApplication *app, + gpointer user_data) +{ + GtkWidget *window; + + window = gtk_application_window_new (app); + gtk_window_set_title (GTK_WINDOW (window), "Window"); + gtk_window_set_default_size (GTK_WINDOW (window), 200, 200); + + gtk_widget_show (window); + g_timeout_add_seconds (1, do_quit, g_object_ref_sink (window)); } int main(int argc, char **argv) { - GtkWidget *dialog; - - gtk_init (&argc, &argv); - dialog = gtk_dialog_new_with_buttons ("Test dialog", NULL, - GTK_DIALOG_MODAL, - "OK", GTK_RESPONSE_ACCEPT, - NULL); - gtk_widget_show_all (dialog); - g_timeout_add_seconds (1, do_quit, NULL); - gtk_main(); - return 0; + GtkApplication *app; + int status; + + app = gtk_application_new ("org.debian.gtk_4_0.example", G_APPLICATION_NON_UNIQUE); + g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); + status = g_application_run (G_APPLICATION (app), argc, argv); + g_object_unref (app); + return status; } EOF gcc -o gtktest gtktest.c `pkg-config --cflags --libs gtk+-4.0` echo "build: OK" [ -x gtktest ] -xvfb-run ./gtktest +#xvfb-run ./gtktest +./gtktest echo "run: OK" -- 2.30.2